package com.whately.core.base.fileupload.qiniu.conf;

import com.whately.core.base.fileupload.qiniu.model.QiNiuBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

@Configuration
@Slf4j
public class QiNiuBeanConfiguration {

    /**
     * 使用接口的形式根据环境注入接口的实现类
     * 如果当前环境是!prod，Log4jBean
     * @return
     */
    @Bean
    @Profile("!prod")
    public QiNiuBean otherQiNiuBean() {
        log.info("none prod QiNiuBean enter ");
        QiNiuBean bean = new QiNiuBean();
        bean.setAccessKey("WGFwLv7swzRd9O9ZfAwSu9ypje2DzXWniok4m79N");
        bean.setSecretKey("x2a3hEpaYM7L8EPXK9QuOD_L1pp7cKL6QtQ0P5Hz");
        bean.setImgOpenedBucket("whately-img");
        bean.setImgOpenedUrls("qnimg01.rcrimg.cn");
        bean.setImgPrivateBucket("whately-private");
        bean.setImgPrivateUrls("qnimgprivate.rcrimg.cn");
        return bean;
    }

    /**
     * 使用接口的形式根据环境注入接口的实现类
     * 如果当前环境是prod，则注入LogbackBean
     * @return
     */
    @Bean
    @Profile("prod")
    public QiNiuBean prodQiNiuBean() {
        log.info("prod QiNiuBean enter ");
        QiNiuBean bean = new QiNiuBean();
        bean.setAccessKey("9ElAVVdrM2vdmQ-rvL3GzXe5-9BXi75mQ39oMMNo");
        bean.setSecretKey("L0kJ9YMd-RXtzvy7KVovyOBJXN8kTiEYdWiYDnLW");
        bean.setImgOpenedBucket("whately-formal-img");
        bean.setImgOpenedUrls("fmimg01.rcrimg.cn");
        bean.setImgPrivateBucket("whately-formal-private");
        bean.setImgPrivateUrls("fmcard01.rcrimg.cn");
        return bean;
    }

}
